<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>个人博客后台登录页面</title>
</head>
<body>
<center>
	<form action=""
		method="post" onsubmit="return checkForm()">
		<input id="userName" placeholder="请输入用户名" /> <br/>
		<input id="password" placeholder="请输入密码" /> <br/>
		<a href="${pageContext.request.contextPath}/index.jsp">个人博客系统</a>		<input type="submit" value="登录" />
	</form>
		<font color="red" id="error"></font>

    </center>
		
		<script>
			function checkForm(){
				//得到name输入框对象
				var userName = document.getElementById("userName");
				//判断输入框是否有内容
				if(userName.value.length==0||userName.value.length==""){
					$("#error").html("用户名不能为空");
					return false;
				}
				var password = document.getElementById("password");
				if(password.value.length==0||password.value.length==""){
					$("#error").html("密码不能为空");
					return false;
				}
				return true;
			}
		</script>
        <script type="text/javascript" src="js/jquery-3.4.1.js"></script>
</body>
</html>